﻿<template>
  <div>
    <!-- 标题栏 -->
    <NavBar
      :title="$route.meta.title"
      :rightBtn="rightBtn"
      @handleIcon="hanldleRight"
    >
    </NavBar>
    <van-tabs v-model="activeKey" swipeable>
      <van-tab :name="0" title="写信">
        <new-form closeName="重置" />
      </van-tab>
      <van-tab :name="1" title="收件箱"><reveive-list type="1" /> </van-tab>
      <van-tab :name="2" title="发件箱"><reveive-list type="2" /> </van-tab>
      <van-tab :name="3" title="草稿箱"><reveive-list type="3" /> </van-tab>
    </van-tabs>
    <edit-form ref="editForm" :afterSubmit="getDataList"></edit-form>
  </div>
</template>

<script>
import NavBar from "@/components/NavBar";
import ReveiveList from "./List";
import NewForm from "./NewForm";
import EditForm from "./EditForm";

export default {
  components: {
    NavBar,
    ReveiveList,
    NewForm,
    EditForm
  },
  mounted() {
    this.getDataList();
    this.rightBtn.number++;
    this.rightBtn.iconName.unshift("plus");
  },
  data() {
    return {
      activeKey: 1,
      rightBtn: {
        number: 0,
        iconName: []
      }
    };
  },
  methods: {
    hanldleRight(item) {
      this.hanldleAdd();
    },
    hanldleAdd() {
      this.$refs.editForm.openForm();
    },
    getDataList() {}
  }
};
</script>
